package com.mouliu.base.syn13;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author mouliu
 * @create 2018-03-31-下午3:59
 */
public class UseConcurrentMap {
    public static void main(String[] args){
        ConcurrentHashMap<String,Object>chm =
                new ConcurrentHashMap<>();

        chm.put("k1","v1");
        chm.put("k2","v2");
        chm.put("k3","v3");
        chm.put("k4","v4");
        chm.putIfAbsent("k4","vvvv");

        for (Map.Entry<String,Object>me:chm.entrySet()){
            System.out.println("key"+me.getKey()+",value:"+me.getValue());
        }
    }
}
